<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        *{padding:0;margin:0;}

    </style>
    <script src="jquery-1.11.1.js"></script>
    <script>
        $(function(){
            var str="2017-6-7";
            var reg=/\d-/g;
            str=str.replace(reg,function($0){
                return $0=$0.charAt(0)+".";
            })
            alert(str);
        });
    </script>
</head>
<body>

</body>
</html>